package com.class05;

/**
 * @ClassDescription: 测试比较运算符的使用：比较运算符
 * 1. == !=(不等) > < >= <= instanceof
 * 2.说明
 * 1）instanceof 在面向对象的多态性的位置讲解。
 * == != > < >= <= 适用于基本数据类型。（细节：> < >= <= 不适用于boolean类型）
 * 运算结果为boolean类型
 * 3）了解：== != 可以使用于引用数据类型
 * 4）区分 == 与 =
 * @JdkVersion: 17
 * @Author: yxy
 * @Created: 2023/12/27 20:15
 */

public class CompareTest9 {
    public static void main(String[] args) {
        int m1 = 10;
        int m2 = 20;
        boolean b = m1 > m2;
        System.out.println("b = " + b);

        int n1 = 10;
        int n2 = 20;
        boolean b1 = m1 == m2;
        System.out.println("b1 = " + b1);

        boolean b11 = false;
        boolean b22 = false;
        System.out.println("b11 == b22 = " + (b11 == b22));

        float f1 = 10.0f;
        float f2 = 20.0f;
        boolean b2 = f1 != f2;
        System.out.println("b2 = " + b2);

        int i = 10;
        int i1 = 10;
        boolean b3 = i >= i1;
        System.out.println(b3);
        if (i != i1){
            System.out.println("吃饭");
        }else {
            System.out.println("睡觉");
        }
    }
}
